import React from 'react'
import { useProfile } from '@/store/profile'
import { Navigate } from 'react-router-dom'

interface IProps {
  children?: React.ReactNode
}
const AuthRouter: React.FC<IProps> = ({ children }) => {
  if (useProfile.token) {
    // 正常跳转
    return <>{children}</>
  } else {
    // 返回登录页面
    return <Navigate to={'/login'}></Navigate>
  }
}

export default AuthRouter
